<template>
	<view class="p30">
		<view class="">新建成功后，客户可以使用注册手机号授权登录，登录后同步信息导入（基本信息，就诊人，订单）</view>
		<u-form labelWidth="auto">
			<view class="fw-w fs32 mb20 mt20">基本信息</view>
			<view class="radius20 bg-fff pl20 pr20 mb20">
				<u-form-item label="客户头像/照片" right-icon="arrow-right">
					<view class="flex row-right w-max">
						<z-imgs up size="120" @success="form.avatar=$event"  />
					</view>
				</u-form-item>
				<u-form-item label="">
					<u-input type="text" v-model="form.name" placeholder="请填写客户姓名" />
				</u-form-item>
				<u-form-item label="">
					<u-input type="number" v-model="form.mobile" maxlength="11" disabled placeholder="请输入团队电话" />
					<view class="">不予修改</view>
				</u-form-item>
				<u-form-item label="">
					<u-input type="text" :modelValue="$user.city_name" disabled placeholder="请选择地区" />
				</u-form-item>
				<u-form-item label="">
					<u-input type="text" v-model="form.address" placeholder="请输入详细地址" />
				</u-form-item>
			</view>
			<!-- 	<view class="fw-w fs32 mb20 mt20">就诊人信息</view>
			<view class="radius20 bg-fff pl20 pr20 mb20">
				<u-form-item label="" v-for="(item,index) in patientList" :key="index">
					<u-input type="text" v-model="item.value" placeholder="请填写就诊人姓名" />
				</u-form-item>
			</view> -->
		</u-form>
		<view class="h120"></view>
		<view class="pf bottom0 left0 bg-fff w-max">
			<view class="flex">
				<view class="flex1 p20">
					<u-button type="warning" ripple @click="submit">提交</u-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					// id: '',
					avatar: '',
					name: '',
					mobile: '',
					address: '',
					// patient: []
				},
				data: '',
				patientList: [],
			};
		},
		onLoad(e) {
			if (e.mobile) this.form.mobile = e.mobile
			// if (e.agency_id) {
			// 	this.getData()
			// 	uni.setNavigationBarTitle({
			// 		title: '编辑团队'
			// 	})
			// }
		},
		methods: {
			getData() {
				// if (!this.$params.agency_id) return
				// this.$request('/master/agency/agencyInfo', this.$params).then(res => {
				// 	this.data = res.data
				// 	Object.keys(this.form).map(key => {
				// 		res.data[key] ? this.form[key] = res.data[key] : ''
				// 	})
				// })
			},
			submit() {
				let params = {
					...this.$params,
					...this.form,
				}
				let api = '/master/customer/createCustomer'
				// if (this.$params.agency_id) api = "/master/agency/editAgency"
				this.$request(api, params).then(res => {
					this.$msg(res.msg)
					let params = {
						member_id: res.data.member_id || res.data.id
					}
					if (params.member_id) {
						setTimeout(() => {
							this.$jump('/pages/my/client/addOrder', params, 'redirectTo')
						}, 1000)
					} else {
						this.$navBack(1, 1000)
					}

				})
			},
		}
	}
</script>

<style lang="scss">

</style>